package net.esj.basic.plugins.struts2.action;

import java.lang.reflect.ParameterizedType;

import net.esj.basic.view.PageAction;

/**
 * 适用于struts2-convention-plugin插件
 * 应convention查找页面只能根据return的string值，所以将原返回success的地方返回相应字符串
 * @author Administrator
 *
 * @param <P>
 * @param <V>
 */
public abstract class ConventionAction<P, V> extends PageAction<P, V> {

	@Override
	public String form() {
		super.form();
		return FORM;
	}

	@Override
	public String edit() {
		super.edit();
		return "edit";
	}
	
	@SuppressWarnings("unchecked")
	protected void generateClass(){
		entityClass = (Class<P>) ((ParameterizedType)getClass().getGenericSuperclass()).getActualTypeArguments()[0];
		voClass = (Class<V>) ((ParameterizedType)getClass().getGenericSuperclass()).getActualTypeArguments()[1];
	}
	
}
